package com.atguigu.oss.utils;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

/**
 * 读取oss配置
 * InitializingBean
 *
 * @author Administrator
 */
@Component
public class OssConfig {

    @Value("${aliyun.oss.endpoint}")
    private String endpoint;
    @Value("${aliyun.oss.accessKeyId}")
    private String accessKeyId;
    @Value("${aliyun.oss.accessKeySecret}")
    private String accessKeySecret;
    @Value("${aliyun.oss.bucketName}")
    private String bucketName;


    public static String END_POINT;
    public static String ACCESSKEYID;
    public static String ACCESSKEYSECRET;
    public static String BUCKETNAME;

    @PostConstruct
    public void afterPropertiesSet() throws Exception {
        END_POINT = endpoint.trim();
        ACCESSKEYID = accessKeyId.trim();
        ACCESSKEYSECRET = accessKeySecret.trim();
        BUCKETNAME = bucketName.trim();
    }
}
